//
//  GKZYMessageViewController.m
//  GKZYAid
//
//  Created by lanou3g on 16/2/27.
//  Copyright © 2016年 GKZYAid. All rights reserved.
//

#import "GKZYMessageViewController.h"
#import "SCNavTabBarController.h"
#import "GKZYSelectionListController.h"
#import "GKZYNewsListController.h"
#import "GKZYReferenceListController.h"
#import "GKZYMaterialListController.h"
#import "GKZYExpertLineListController.h"
#import "DatabaseRongcloud.h"
#import "GKZYChatListController.h"
#import "GKZYRegisteredController.h"

@interface GKZYMessageViewController ()

@end

@implementation GKZYMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"资讯";
    self.view.backgroundColor = [UIColor whiteColor];
    [DatabaseRongcloud shareIntance].block = ^
    {
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"消息" style:UIBarButtonItemStyleDone target:self action:@selector(rightAction)];
        
        self.navigationItem.leftBarButtonItem  = [[UIBarButtonItem alloc]initWithTitle:@"注销" style:UIBarButtonItemStylePlain target:self action:@selector(leftAction)];
    };
    
    GKZYSelectionListController *selectionVC = [[GKZYSelectionListController alloc]init];
    selectionVC.title = @"精选";
    
    
    GKZYNewsListController *newsVC = [[GKZYNewsListController alloc]init];
    newsVC.title = @"新闻";
    
    GKZYReferenceListController *referenceVC = [[GKZYReferenceListController alloc]init];
    referenceVC.title = @"备考";
    
    GKZYMaterialListController *materiaVC = [[GKZYMaterialListController alloc]init];
    materiaVC.title = @"资料";
    
    GKZYExpertLineListController *expertLineVC = [[GKZYExpertLineListController alloc]init];
    expertLineVC.title = @"专家在线";
    
    
    SCNavTabBarController *controllerVC = [[SCNavTabBarController alloc]init];
    controllerVC.subViewControllers = @[selectionVC,newsVC,referenceVC,materiaVC,expertLineVC];
    controllerVC.navTabBarColor = [UIColor orangeColor];
    controllerVC.mainViewBounces = YES;
    [controllerVC addParentController:self];
    
    
    
    // Do any additional setup after loading the view.
}


//消息按钮的点击事件
- (void)rightAction
{
    GKZYChatListController *chatList = [[GKZYChatListController alloc] init];
    [self.navigationController pushViewController:chatList animated:YES];
}

//注销按钮的点击事件:
- (void)leftAction{
    
    GKZYRegisteredController *registerVC = [[GKZYRegisteredController alloc]init];
    [self.navigationController pushViewController:registerVC animated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
